package com.funquer.cms.model;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 13-3-22
 * Time: 下午6:13
 * To change this template use File | Settings | File Templates.
 */
@Table(name = "arctype")
@Entity
public class ArctypeEntity {
    private String id;

    @Column(name = "id")
    @Id
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    private String typeName;

    @Column(name = "type_name")
    @Basic
    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    /*private String channelType;

    @Column(name = "channel_type")
    @Basic
    public String getChannelType() {
        return channelType;
    }

    public void setChannelType(String channelType) {
        this.channelType = channelType;
    }*/

    /*private String parentType;

    @Column(name = "parent_type")
    @Basic
    public String getParentType() {
        return parentType;
    }

    public void setParentType(String parentType) {
        this.parentType = parentType;
    }*/

    /*private String topType;

    @Column(name = "top_type")
    @Basic
    public String getTopType() {
        return topType;
    }

    public void setTopType(String topType) {
        this.topType = topType;
    }*/

    private String typeDir;

    @Column(name = "type_dir")
    @Basic
    public String getTypeDir() {
        return typeDir;
    }

    public void setTypeDir(String typeDir) {
        this.typeDir = typeDir;
    }

    private int sortrank;

    @Column(name = "sortrank")
    @Basic
    public int getSortrank() {
        return sortrank;
    }

    public void setSortrank(int sortrank) {
        this.sortrank = sortrank;
    }

    private int isValid;

    @Column(name = "is_valid")
    @Basic
    public int getValid() {
        return isValid;
    }

    public void setValid(int valid) {
        isValid = valid;
    }

    private int isPart;

    @Column(name = "is_part")
    @Basic
    public int getPart() {
        return isPart;
    }

    public void setPart(int part) {
        isPart = part;
    }

    private int isSend;

    @Column(name = "is_send")
    @Basic
    public int getSend() {
        return isSend;
    }

    public void setSend(int send) {
        isSend = send;
    }

    private String tempindex;

    @Column(name = "tempindex")
    @Basic
    public String getTempindex() {
        return tempindex;
    }

    public void setTempindex(String tempindex) {
        this.tempindex = tempindex;
    }

    private String templist;

    @Column(name = "templist")
    @Basic
    public String getTemplist() {
        return templist;
    }

    public void setTemplist(String templist) {
        this.templist = templist;
    }

    private String temparticle;

    @Column(name = "temparticle")
    @Basic
    public String getTemparticle() {
        return temparticle;
    }

    public void setTemparticle(String temparticle) {
        this.temparticle = temparticle;
    }

    private String arcrule;

    @Column(name = "arcrule")
    @Basic
    public String getArcrule() {
        return arcrule;
    }

    public void setArcrule(String arcrule) {
        this.arcrule = arcrule;
    }

    private String listrule;

    @Column(name = "listrule")
    @Basic
    public String getListrule() {
        return listrule;
    }

    public void setListrule(String listrule) {
        this.listrule = listrule;
    }

    private String seotitle;

    @Column(name = "seotitle")
    @Basic
    public String getSeotitle() {
        return seotitle;
    }

    public void setSeotitle(String seotitle) {
        this.seotitle = seotitle;
    }

    private String keywords;

    @Column(name = "keywords")
    @Basic
    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    private String descriptionContent;

    @Column(name = "description_content")
    @Basic
    public String getDescriptionContent() {
        return descriptionContent;
    }

    public void setDescriptionContent(String descriptionContent) {
        this.descriptionContent = descriptionContent;
    }

    private Timestamp createtime;

    @Column(name = "createtime")
    @Basic
    public Timestamp getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Timestamp createtime) {
        this.createtime = createtime;
    }

    private String creater;

    @Column(name = "creater")
    @Basic
    public String getCreater() {
        return creater;
    }

    public void setCreater(String creater) {
        this.creater = creater;
    }

    private String remark;

    @Column(name = "remark")
    @Basic
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ArctypeEntity that = (ArctypeEntity) o;

        if (isPart != that.isPart) return false;
        if (isSend != that.isSend) return false;
        if (isValid != that.isValid) return false;
        if (sortrank != that.sortrank) return false;
        if (arcrule != null ? !arcrule.equals(that.arcrule) : that.arcrule != null) return false;
//        if (channelType != null ? !channelType.equals(that.channelType) : that.channelType != null) return false;
        if (creater != null ? !creater.equals(that.creater) : that.creater != null) return false;
        if (createtime != null ? !createtime.equals(that.createtime) : that.createtime != null) return false;
        if (descriptionContent != null ? !descriptionContent.equals(that.descriptionContent) : that.descriptionContent != null)
            return false;
        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (keywords != null ? !keywords.equals(that.keywords) : that.keywords != null) return false;
        if (listrule != null ? !listrule.equals(that.listrule) : that.listrule != null) return false;
//        if (parentType != null ? !parentType.equals(that.parentType) : that.parentType != null) return false;
        if (remark != null ? !remark.equals(that.remark) : that.remark != null) return false;
        if (seotitle != null ? !seotitle.equals(that.seotitle) : that.seotitle != null) return false;
        if (temparticle != null ? !temparticle.equals(that.temparticle) : that.temparticle != null) return false;
        if (tempindex != null ? !tempindex.equals(that.tempindex) : that.tempindex != null) return false;
        if (templist != null ? !templist.equals(that.templist) : that.templist != null) return false;
//        if (topType != null ? !topType.equals(that.topType) : that.topType != null) return false;
        if (typeDir != null ? !typeDir.equals(that.typeDir) : that.typeDir != null) return false;
        if (typeName != null ? !typeName.equals(that.typeName) : that.typeName != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (typeName != null ? typeName.hashCode() : 0);
//        result = 31 * result + (channelType != null ? channelType.hashCode() : 0);
//        result = 31 * result + (parentType != null ? parentType.hashCode() : 0);
//        result = 31 * result + (topType != null ? topType.hashCode() : 0);
        result = 31 * result + (typeDir != null ? typeDir.hashCode() : 0);
        result = 31 * result + sortrank;
        result = 31 * result + isValid;
        result = 31 * result + isPart;
        result = 31 * result + isSend;
        result = 31 * result + (tempindex != null ? tempindex.hashCode() : 0);
        result = 31 * result + (templist != null ? templist.hashCode() : 0);
        result = 31 * result + (temparticle != null ? temparticle.hashCode() : 0);
        result = 31 * result + (arcrule != null ? arcrule.hashCode() : 0);
        result = 31 * result + (listrule != null ? listrule.hashCode() : 0);
        result = 31 * result + (seotitle != null ? seotitle.hashCode() : 0);
        result = 31 * result + (keywords != null ? keywords.hashCode() : 0);
        result = 31 * result + (descriptionContent != null ? descriptionContent.hashCode() : 0);
        result = 31 * result + (createtime != null ? createtime.hashCode() : 0);
        result = 31 * result + (creater != null ? creater.hashCode() : 0);
        result = 31 * result + (remark != null ? remark.hashCode() : 0);
        return result;
    }


    private Set<ArctypeEntity> childrenArcType;

    @OneToMany(mappedBy = "parentArcType",fetch = FetchType.LAZY,cascade = CascadeType.ALL)
    public Set<ArctypeEntity> getChildrenArcType() {
        return childrenArcType;
    }

    public void setChildrenArcType(Set<ArctypeEntity> childrenArcType) {
        this.childrenArcType = childrenArcType;
    }

    private ArctypeEntity parentArcType;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "parent_type", referencedColumnName = "id")
    public ArctypeEntity getParentArcType() {
        return parentArcType;
    }

    public void setParentArcType(ArctypeEntity parentArcType) {
        this.parentArcType = parentArcType;
    }

    private ArctypeEntity topParentArcType;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "top_type", referencedColumnName = "id")
    public ArctypeEntity getTopParentArcType() {
        return topParentArcType;
    }

    public void setTopParentArcType(ArctypeEntity topParentArcType) {
        this.topParentArcType = topParentArcType;
    }

    private Set<ArctypeEntity> topChildrenArcType;

    @OneToMany(mappedBy = "topParentArcType",fetch = FetchType.LAZY,cascade = CascadeType.ALL)
    public Set<ArctypeEntity> getTopChildrenArcType() {
        return topChildrenArcType;
    }

    public void setTopChildrenArcType(Set<ArctypeEntity> topChildrenArcType) {
        this.topChildrenArcType = topChildrenArcType;
    }


    private ChanneltypeEntity channalTypeRef;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "channel_type", referencedColumnName = "id")
    public ChanneltypeEntity getChannalTypeRef() {
        return channalTypeRef;
    }

    public void setChannalTypeRef(ChanneltypeEntity channalTypeRef) {
        this.channalTypeRef = channalTypeRef;
    }
}
